#include"DependencyWriter.h"
#include"CONLLWriter.h"

CONLLWriter::CONLLWriter() : DependencyWriter(){};

CONLLWriter::CONLLWriter(bool labeled, bool hasEnd){
	this->labeled = labeled;
	this->hasEnd = hasEnd;
}

void CONLLWriter::write(vector<string*> &forms, vector<string*> &lemma, vector<string*> &cpos, vector<string*> &pos, vector<string*> &labs, vector<int> &heads){
	int length = (int)(forms.size());
	if(hasEnd){
		length = length - 1;
	}
	string* str;
	string* str2;
	for(int i = 0; i<length; ++i){
		fprintf(writer, "%d\t", i + 1);

		str = forms[i];
		str2 = lemma[i];
		fprintf(writer, "%s\t%s\t", str->c_str(), str2->c_str());

		str = cpos[i];
		str2 = pos[i];
		fprintf(writer, "%s\t%s\t_\t%d\t", str->c_str(), str2->c_str(), heads[i]);

		str = labs[i];
		fprintf(writer, "%s\n", str->c_str());
	}
	fputc('\n', writer);
}

